// 管理用户相关的接口
import request from '@/utils/reuqest'
import { LoginDto, UserVo, PermissionsVo } from './type'
import { RouteRecordRaw } from 'vue-router'
// 对外暴露
export function login(data: LoginDto): Promise<void> {
  return request({
    url: '/user/login',
    method: 'post',
    data: data
  })
}

/**
 * 获取用户信息的接口
 * @returns
 */
export function getUserInfo(): Promise<UserVo> {
  return request({
    url: '/user/getUserInfo',
    method: 'get'
  })
}

/**
 * 获取权限的接口
 * @returns
 */
export function getPermission(): Promise<PermissionsVo> {
  return request({
    url: '/user/getPermission',
    method: 'get'
  })
}

/**
 * 获取路由的接口
 * @returns
 */
export function getRouters(): Promise<RouteRecordRaw[]> {
  return request({
    url: '/user/getRouters',
    method: 'get'
  })
}
/**
 * 退出登录
 * @returns
 */
export function logout() {
  return request({
    url: '/user/logout',
    method: 'get'
  })
}
